<?
include("common/header.html");
include("../_made/le.cfg.php");
//include("common/page.php");
include("common/left.html");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
if(!$_SESSION['memberID']){exit("<script>window.location='dlogin.html'</script>");}
$currentPage=$_REQUEST["currentPage"]?$_REQUEST["currentPage"]:1;
$pageSize=$_REQUEST['pageSize']?$_REQUEST["pageSize"]:7;
$sid=$_SESSION['memberID'];
$did=$_REQUEST["did"];
$id=$_REQUEST["id"];
$act=$id?"修改":"创建";
$prod=array();
$sel="select * from uu_products where p_status in (0,3) and apply_limit=1 and apply_did=".$sid;//." limit ".($currentPage-1)*$pageSize.",".$pageSize;
// $sel="select p.id,l.title as ltitle,t.title as ttitle from uu_products p left join uu_land l on p.contact_id=l.id left join uu_jq_ticket t on p.id=t.pid where p.p_status in (0,3) and p.apply_limit=1 and p.apply_did=".$sid;//." limit ".($currentPage-1)*$pageSize.",".$pageSize;

$GLOBALS['le']->query($sel);
while($row=$GLOBALS['le']->fetch_assoc()){
	$pri=$s->get_Dynamic_Price_Merge($row['id'],date("Y-m-d"),2);
	if($pri==-1){continue;}
	$row['pri']=$pri/100;
    // $row['p_name'] = $row['ltitle'].$row['ttitle'];
	$prod[]=$row;
}
if($id){
	$sel="select title,tid,price from uu_fx_pri_tpl where distid=".$sid." and id=".$id;
	$GLOBALS['le']->query($sel);
	$GLOBALS['le']->fetch_assoc();
	$title=$GLOBALS['le']->f("title");
	$tpl=$GLOBALS['le']->f("tid")?array_combine(explode("|",$GLOBALS['le']->f("tid")),explode("|",$GLOBALS['le']->f("price"))):array();
}
/*$sel="select count(*) total from uu_products where p_status in (0,3) and apply_did=".$sid;
$GLOBALS['le']->query($sel);
$GLOBALS['le']->fetch_assoc();
$total=$GLOBALS['le']->f("total");*/
include("tpl/addtpl.html");
include("common/footer.html");?>